package pojo;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "Reward")
public class Reward implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -3135274373623388745L;

	@Id @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "reward_id")
    private int rewardId;
	
	@Column(name = "name")
	private String name;
	
	@Column(name = "first_prize")
    private int firstPrize;
	
	@Column(name = "second_prize")
    private int secondPrize;
	
	@Column(name = "third_prize")
    private int thirdPrize;
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "reward")
	private Set<League> leagues = new HashSet<League>();
	
	public Reward() {}
	
	public Reward(int id) {
		this.rewardId = id;
	}
	
	public Reward(String name, int firstPrize, int secondPrize, int thirdPrize) {
		this.name = name;
		this.firstPrize = firstPrize;
		this.secondPrize = secondPrize;
		this.thirdPrize = thirdPrize;
	}

	public int getRewardId() {
		return rewardId;
	}

	public void setRewardId(int rewardId) {
		this.rewardId = rewardId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getFirstPrize() {
		return firstPrize;
	}

	public void setFirstPrize(int firstPrize) {
		this.firstPrize = firstPrize;
	}

	public int getSecondPrize() {
		return secondPrize;
	}

	public void setSecondPrize(int secondPrize) {
		this.secondPrize = secondPrize;
	}

	public int getThirdPrize() {
		return thirdPrize;
	}

	public void setThirdPrize(int thirdPrize) {
		this.thirdPrize = thirdPrize;
	}

	public Set<League> getLeagues() {
		return leagues;
	}

	public void setLeagues(Set<League> leagues) {
		this.leagues = leagues;
	}
	
	public String toString(){
	      return name;
	}
}
